home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / mathstud.zip / TRIL.M < prev    next >
Text File  |  1993-03-23  |  277b  |  15 lines

  1. function Y = tril(X,k)
  2. %Y=tril(X,k)
  3. %Lower triangle matrix of X
  4.  
  5. %       S.Halevy 7/31/92
  6. %       Copyright (c) 1992 by the MathWizards
  7.  
  8. k=expr_sel(nargin==1,0,k);
  9. [m,n] = size(X);
  10. Y = zeros(m,n);
  11. for i = max(1,1-k):m
  12.    j = 1:min(n,i+k);
  13.    Y(i,j) = X(i,j);
  14. end
  15.